arm/p2m: Rework p2m_init()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 18 Oct 2022 14:23:45 +0000 (14:23 +0000)
committerJulien Grall <jgrall@amazon.com>
Thu, 20 Oct 2022 08:39:56 +0000 (09:39 +0100)
commit3783e583319fa1ce75e414d851f0fde191a14753
tree2e3c3bd47aa06ca5b1e2c476fa7ae65a372c1a9a
parentcc4747be8ba157a3b310921e9ee07fb8545aa206
arm/p2m: Rework p2m_init()

p2m_init() is mostly trivial initialisation, but has two fallible operations
which are on either side of the backpointer trigger for teardown to take
actions.

p2m_free_vmid() is idempotent with a failed p2m_alloc_vmid(), so rearrange
p2m_init() to perform all trivial setup, then set the backpointer, then
perform all fallible setup.

This will simplify a future bugfix which needs to add a third fallible
operation.

No practical change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
xen/arch/arm/p2m.c